﻿namespace _55跳跃游戏
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Solution.CanJump(new int[] { 3, 2, 1, 0, 4 }));
        }
    }
    public class Solution
    {
        public static  bool CanJump(int[] nums)
        {
            int lastPos = nums.Length - 1;

            for (int i = nums.Length - 1; i >= 0; i--)
            {
                if (i + nums[i] >= lastPos)
                {
                    lastPos = i;
                }
            }

            return lastPos == 0;
        }
    }
}